/**
 *
 * Created by bunny on 2017/8/26.
 */
(function($) {

    $(document).ready(function () {
        $('#btn-registration').click(function () {
            var name = $('#user-name').val().trim();
            var pass = $('#user-pass ').val().trim();
            var birthday = $('#user-birthday').val();
            var sex = $(`input:radio[name="sample-radio"]:checked`).val();

            if (name.length < 1) {
                alert('用户名为空');
                return false;
            }

            $.ajax({
                url: '/account/regerstion',
                data: { name:name, pass: pass, birthday: birthday, sex: sex},
                dataType: 'json',
                type: 'post'
            }).success(function (data) {
                console.log(data);
                if (data.code == true)
                    alert('注册成功');

            }).fail(function (data){
                console.log(data);
                if(data.code == false)
                alert('请重新注册')

            });
        });
    });

}(jQuery));
